{extend name="page_base" /} {block name="seo"}
<title>友链申请 - {$site_config['seo_title']}</title>
<meta name="keywords" content="{$site_config['seo_keyword']}">
<meta name="description" content="{$site_config['seo_description']}">
{/block}
{block name="css"}

{/block}
{block name="main"}
<div class="text-content">
    <div class="title">
        <h3>申请友情链接</h3>
    </div>
    <div class="thisContent layui-clear">
        <form class="send layui-form">
            <input type="text" name="name" lay-verify="min_2" placeholder="网站标题"
                   style="margin:0;float:left;width:48%;"/>
            <input type="text" name="link" lay-verify="link" placeholder="网站域名以http(s)://开头"
                   style="margin:0;float:left;width:48%;margin-left:4%"/>
            <input type="text" name="qq" maxlength="11" lay-verify="min_2" placeholder="您的QQ号"
                   style="margin-top:20px;float:left;width:calc(98% - 288px);"/>
            <input name="captcha" lay-verify="required" maxlength="4" type="text" placeholder="验证码"
                   style="margin-top:20px;float:left;width:120px;margin-left:4%"/>
            <img src="{:url('index/page/captcha')}?'+Math.random();" title="点击可刷新验证码" onclick="this.src='{:url('index/page/captcha')}?'+Math.random();" id="img_code"
                 style="margin-top:20px;width:144px;height:45px;cursor:pointer">
            <input type="submit" lay-submit lay-filter="save_btn" value="提 交" class="btn"
                   style="margin-top:30px;"/>
        </form>
        <div class="tj">
            友链条件：<br/>
            1、百度权重{$site_config['apply_friendly_baidu_pr']}以上<br/>
            2、正规网站，不违反中国法律的<br/>
            3、已将{$site_config['site_title']}({$_SERVER['HTTP_HOST']})添加为友链的<br/>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    layui.use(['layer','form'], function(){
        var layer = layui.layer;
        var form = layui.form;

        form.verify({
            link: [
                /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/
                ,'小可爱，网址不正确哦,(带上http或者htpps)'
            ],
            qq:[
                /^[1-9]([0-9]{5,11})$/,
                'QQ号格式不正确！'
            ],
            min_10_max_300:[
                /^.{10,300}$/,
                '请输入10到300位字符'
            ]
        });
        form.on('submit(save_btn)', function(data){
            request({
                data:{
                    data:data.field,
                    post_type:'add_link'
                },
                done:function () {
                    $("#img_code").click();
                }

            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>
{/block}